<template>
  <view v-if="shenheStatus == 0" class="record-card flex-col">
    <view class="item-box">
      <view class="item" v-for="item in list.data" :key="item.id">
        <view class="flex-y-center flex-x-sb">
          <view class="left">
            <view class="title">{{ item.describe }}</view>

            <view class="date" v-if="item.type === '1'">
               核销门店：{{ item.shop_name }}  
            </view>
            <view class="date" v-if="item.type === '1'">
                核销员工：{{ item.verify_person }}
            </view>
            <view class="date">
              {{ item.use_time }}
            </view>
          </view>
          <view class="right">-1</view>
        </view>
      </view>
    </view>
    <u-loadmore
      style="margin-top: 20rpx"
      @loadmore="getList(true)"
      :status="list.isBottom ? 'nomore' : 'loadmore'"
    />
  </view>
  <Shenhe v-else-if="shenheStatus == 1"></Shenhe>
</template>

<script>
import Shenhe from '@/components/shenhe/shenhe';
export default {
  components: { Shenhe },
  data() {
    return {
      id: '',
      list: {
        data: [],
        page: 1,
        isBottom: false,
      },
    };
  },
  onLoad(params) {
    this.id = params.id;
    this.getList(false);
  },
  methods: {
    async getList(isbottom) {
      try {
        if (!isbottom) {
          this.list = this.$options.data().list;
        }
        if (this.list.isBottom) return;

        const res = await this.$allrequest.coupon.verifyLog({}, true);
        this.list.data.push(...res.data.log_list);
        this.list.isBottom = this.list.data.length == res.num;
        this.list.page++;
      } catch (error) {
        this.$utils.toast(error.msg || error);
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.record-card {
  color: #262626;
  padding: 24rpx 0;
  background: #f2f2f2;
  min-height: 100vh;
}
.item-box {
  flex: 1;
}
.item {
  background: #fff;
  padding: 0 24rpx;
  > view {
    margin: 0 24rpx;
    padding: 24rpx 0;
    border-bottom: 1px solid #f1f1f1;

    .title {
      line-height: 48rpx;
    }
    .left {
      flex: 1;
      width: 0;
    }
    .right {
      font-size: 36rpx;
      font-weight: 600;
    }
    .date {
      padding-top: 5rpx;
      line-height: 34rpx;
      font-size: 24rpx;
      color: #8c8c8c;
    }
  }
  &:nth-last-child(1) > view {
    border: 0;
  }
}
</style>
